import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;

/**
 * Project : SRCS-TME2
 * Date : 2 mars 2011
 * Author : Yoann
 */
/**
 * @author Yoann
 *
 */
public class HttpRequest extends Thread{
	private Socket client;
	private BufferedReader br;
	//private InputStreamLiner isl;
	
	public HttpRequest (Socket client){
		this.client = client;
		try {
			br = new BufferedReader(new InputStreamReader(client.getInputStream()));
			//isl = new InputStreamLiner(client.getInputStream());
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	public void processRequest(String request){
		if (request.substring(0, 3).equals("GET")){
			processGet(request);
		}
		else if (request.substring(0, 3).equals("PUT")){
			processPut(request);
		}
	}
	public void processGet(String request){
		System.out.println("processGet");
	}
	public void processPut(String request){
		System.out.println("processPut");
	}
	public void run(){
		System.out.println("Client service started");
		try {
			processRequest(br.readLine());
			/*String s = isl.readLineWin();
			System.out.println(s);
			processRequest(s);*/
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(0);
		}
	}
}
